<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
	xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:p="http://primefaces.org/ui">

<ui:composition>
	<h:outputText value="System error: Purchase model List is null"
		rendered="#{purchaseModel.list == null}" />
	<h:outputText value="System error: Purchase model current is null"
		rendered="#{purchaseModel.current == null}" />
	<p:dataTable id="purchaseListTable" var="purchase" filterEvent="enter"
		value="#{purchaseModel.list}" filteredValue="#{purchaseModel.filteredList}" rowKey="#{purchase.id}"
		selection="#{purchaseModel.current}" selectionMode="single"
		paginator="true" paginatorPosition="top"
		paginatorAlwaysVisible="false" rows="10"
		rowsPerPageTemplate="5,7,10,15,20,30,40,50"
		paginatorTemplate="{CurrentPageReport}  {FirstPageLink} {PreviousPageLink} {PageLinks} {NextPageLink} {LastPageLink} {RowsPerPageDropdown}">
		<p:ajax event="rowSelect" update=":detailForm,:headerForm"
			listener="#{purchaseController.onRowSelect}"></p:ajax>


		<p:column sortBy="#{purchase.id}">
			<h:outputText value="#{purchase.id}" />
		</p:column>
		<p:column sortBy="#{purchase.number}">
			<f:facet name="header">
				<p:commandButton ajax="true" update=":listForm,:detailForm"
					actionListener="#{purchaseController.initWithoutCheck}"
					value="Reload" style=" font-size:0.9em;float:left"></p:commandButton>
			</f:facet>
			<h:outputText value="#{purchase.number}" />
		</p:column>
		<p:column  sortBy="#{purchase.status.label}"
			filterBy="#{purchase.status.label}" filterMatchMode="contains">
			<h:outputText value="#{purchase.status.label}" />
		</p:column>
		<p:column headerText="Purchased Date"
			sortBy="#{purchase.purchasedDate}">
			<h:outputText value="#{purchase.purchasedDate}" />
		</p:column>
		<p:column headerText="Required Date" sortBy="#{purchase.requiredDate}">
			<h:outputText value="#{purchase.requiredDate}" />
		</p:column>
		<p:column headerText="Received Date" sortBy="#{purchase.receivedDate}">
			<h:outputText value="#{purchase.receivedDate}" />
		</p:column>
		<p:column headerText="Paid Date" sortBy="#{purchase.paidDate}">
			<h:outputText value="#{purchase.paidDate}" />
		</p:column>
	</p:dataTable>


</ui:composition>
</html>